
/**
 * 公共基础接口封装
 */
 import request from '@/utils/request'
 
// 获取分类参数
export const getCategoriesParam = (id, type) => {
  return request({
    method: 'GET',
    url: `/categories/${id}/attributes`,
    params: { sel: type }
  })
}

// 添加动态参数/静态属性
export const addAttrVals = (cateId, attrId, data) => {
  return request({
    method: 'PUT',
    url: `/categories/${cateId}/attributes/${attrId}`,
    data
  })
}

// 添加动态参数或者静态属性
export const addParams = (cateId, data) => {
  return request({
    method: 'POST',
    url: `/categories/${cateId}/attributes`,
    data
  })
}

// 编辑动态参数或者静态属性
export const editParams = (cateId, data) => {
  return request({
    method: 'PUT',
    url: `/categories/${cateId}/attributes/${data.attr_id}`,
    data
  })
}

// 删除动态参数或者静态属性
export const deleteParams = (cateId, attrId) => {
  return request({
    method: 'DELETE',
    url: `/categories/${cateId}/attributes/${attrId}`
  })
}
